home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / rambat1.zip / RAMBATCH.TXT < prev   
Text File  |  1992-03-22  |  7KB  |  163 lines

  1.  
  2.  
  3.  
  4.                                     RAMBATCH
  5.         
  6.                                    Version 1.0
  7.         
  8.         
  9.                                  Copyright 1992
  10.         
  11.                                   Jay E. Morris
  12.                                  P.O. Box 362271
  13.                                Melbourne, FL 32926
  14.         
  15.         OVERVIEW
  16.         
  17.         RAMBATCH is an implementation in Pascal of a concept presented in 
  18.         the February 1992 issue of PCComputing.
  19.         
  20.         To  understand the need for RAMBATCH, one must  first  understand 
  21.         how DOS handles disk drives.  When DOS formats a disk, floppy  or 
  22.         hard, it divides it into sectors.  Then a number of  sectors  are 
  23.         grouped  into  clusters.   The number of sectors  in  a  clusters 
  24.         depends  upon  the  size of a disk.  A 360K floppy  will  have  a 
  25.         cluster size of 512 bytes, a large hard drive will have a cluster 
  26.         size of 2048 bytes.  When DOS allocates space to a file, it  does 
  27.         it  by cluster. So a 20 byte, 150 byte and 2000 byte  file  would 
  28.         all actually take the same amount of disk space on a hard  drive.  
  29.         DOS never assigns a partial cluster.
  30.         
  31.         If  one  uses many batch files, this problem is  compounded.   If 
  32.         there  are 30 batch files with an average size of 80  bytes,  the 
  33.         DIR  command would show that these files use 2400 bytes.  But  in 
  34.         reality,  since each file is allocated a minimum of  2048  bytes, 
  35.         61,440  bytes of disk space is used.  The more batch  files,  the 
  36.         greater the loss.
  37.         
  38.         RAMBATCH  solves this problems by the use of one input file  that 
  39.         contains  all  the batch files.  This file is read  in  and  each 
  40.         batch  file is written to a RAM disk.  Using the  example  above, 
  41.         this  one  file would take two clusters, or  4096  bytes,  verses 
  42.         61,440 for all the separate batch files.
  43.         
  44.         The  drawback is that you must allocate some of your RAM for  the 
  45.         RAM disk.  Depending one your system, this may be less of a  loss 
  46.         than the loss of 60,000 bytes of disk space.
  47.         
  48.         SETUP
  49.         
  50.         Initial setup involves the creation of a RAM disk in memory.  All 
  51.         examples given here are in DOS 5.0.  The DOS 5.0 RAM disk  driver 
  52.         allows  one  to specify the size of the disk (default  64K),  the 
  53.         sector  size  (default 512), and the number of  entries  (default 
  54.         64).   By  the use of the /E switch, the disk can be  created  in 
  55.         extended  memory.  The /a switch will load the drive in  expanded 
  56.         memory.   The  RAMDRIVE.SYS driver itself can also be  loaded  in 
  57.         high memory. To determine the minimum size RAM disk, multiply the 
  58.         number  of batch files times the sector size.  Using the  example 
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.         from above, 30 files time 128 is  3840 bytes.  Any file over  128 
  66.         bytes would require extra sectors, one for each 128 bytes.  Since 
  67.         the  minimum  disk size is 16K, this is what we would  use.   The 
  68.         CONFIG.SYS line would be:
  69.         
  70.              DEVICEHIGH=C:\DOS\RAMDRIVE 16,128 /E
  71.         
  72.         If DOS 5.0 is not used, the line is:
  73.         
  74.              DEVICE=C:\DOS\RAMDRIVE 16,128
  75.         
  76.         DOS will assign the next available drive letter to the drive.  If 
  77.         you have drives A, B, and C, the RAM disk will be D.  
  78.         
  79.         Next  you  must create the input file.  The file  must  be  named 
  80.         BATCH.LIS  and be on the root (top) directory of the  drive  RAM-
  81.         BATCH is running on.  The first line of the file MUST be the  RAM 
  82.         drive  letter.   The next line is the start of  the  first  batch 
  83.         file.   Each  batch file starts with the key word START  and  the 
  84.         name  of the batch file.  The word start MUST be in  caps.   Each 
  85.         line  of the batch file follows.  Do not put in any  blank  lines 
  86.         unless  the batch file itself requires it.  Following is a  short 
  87.         example.
  88.         
  89.              d:
  90.              START PC.BAT
  91.              @echo off
  92.              c:
  93.              cd \procalc
  94.              halortp4
  95.              procalc %1 %2 %3 %4 %5
  96.              halortp4 -u > nul
  97.              cd \
  98.              START MC.BAT
  99.              @echo off
  100.              c:
  101.              cd\mc
  102.              mc -k
  103.              c:
  104.              cd\
  105.              CLS
  106.              START DB.BAT
  107.              @echo off
  108.              c:
  109.              cd\
  110.              cd\dbase
  111.              dbase
  112.              cd\
  113.              c:
  114.              cd\
  115.              cls
  116.         
  117.         The word start can be used in a batch file as long as it does not 
  118.         begin in column one or is in lowercase.  There is no  requirement 
  119.         to end the file in any special way.
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.         
  127.         Finally, add a line to your AUTOEXEC.BAT file to execute RAMBATCH 
  128.         upon bootup.
  129.         
  130.         When  your  system  boots, you will see a  line  indicating  that 
  131.         RAMBATCH has created the batch files and a count of the number of 
  132.         batch  files created.  This is a double check to insure that  the 
  133.         batch  files have been created correctly.  If a START keyword  is 
  134.         out  of  place or not in upper case, the batch file will  not  be 
  135.         created or added to the count.  Thus if the count you see is  not 
  136.         what you think it should be, check your input file.
  137.         
  138.         
  139.         MISC AND DISCLAIMER
  140.         
  141.         No  warranty is expressed or implied.  This software is  provided 
  142.         as is.
  143.         
  144.         This is a freeware program.  No remuneration is requested (but if 
  145.         you feel an overwhelming urge to contribute, feel free.)  If  you 
  146.         wish a copy of the source code, send $1 for hard copy or $3 for a 
  147.         diskette (5.25") to:
  148.         
  149.             Jay E. Morris
  150.             P.O. Box 362271
  151.             Melbourne, FL 32936
  152.         
  153.         or  if you have Internet access, contact me  at:
  154.             morris@patrick-pims.af.mil
  155.         
  156.         and I'll send you the code.
  157.         
  158.         As a last resort, try CompuServe: 73007,3107
  159.         
  160.         But I'm not there often.
  161.  
  162.  
  163.